package com.soulgame.notification;

import java.util.Calendar;

public class DayUtil {

	public static final float daysBetweenInNow(long earlyMillis) {
		Calendar calst = java.util.Calendar.getInstance();
		Calendar caled = java.util.Calendar.getInstance();
		calst.setTimeInMillis(earlyMillis);
		caled.setTimeInMillis(System.currentTimeMillis());
		// 设置时间为0时
//		calst.set(java.util.Calendar.HOUR_OF_DAY, 0);
//		calst.set(java.util.Calendar.MINUTE, 0);
//		calst.set(java.util.Calendar.SECOND, 0);
//		caled.set(java.util.Calendar.HOUR_OF_DAY, 0);
//		caled.set(java.util.Calendar.MINUTE, 0);
//		caled.set(java.util.Calendar.SECOND, 0);
//		Log.d("calst", calst.get(Calendar.YEAR) + "年" + (calst.get(Calendar.MONTH) + 1)  + "月" + calst.get(Calendar.DAY_OF_MONTH) + "日");
//		Log.d("caled", caled.get(Calendar.YEAR) + "年" + (caled.get(Calendar.MONTH) + 1) + "月" + caled.get(Calendar.DAY_OF_MONTH) + "日");
		// 得到两个日期相差的天数
		float days = ((float)(caled.getTime().getTime() / 1000) - (float)(calst.getTime().getTime() / 1000)) / 3600.0f / 24.0f;
		return days;
	}

}
